<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑留言</title>
    <link rel="stylesheet" href="__PEAR__/component/pear/css/pear.css" />
    <script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
<style>
.longtxt{width:500px;}
</style>
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                  <div class="layui-form-item ">
                  	<div class="layui-col-md6">
					    <label class="layui-form-label">留言类别</label>
					    <div class="layui-input-inline">
					      <select name="sltCategory" id="sltCategory">
									{volist name="category" id="vo"}
									<option {if condition="$vo['guestbook_ctg_id'] eq $mGuestbook['guestbook_ctg_id']"} selected="selected"{/if} value="{$vo['guestbook_ctg_id']}">{$vo['ctg_name']}</option>
									{/volist}
							</select>
					    </div>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				  <div class="layui-col-md12">
				    <label class="layui-form-label">留言标题</label>
				    <div class="layui-input-inline">
				      <input type="text" name="txtTitle" value="{$mGuestbookExt.title}" required  lay-verify="required" placeholder="请输入广告名称" autocomplete="off" class="layui-input longtxt">
				    </div>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				  <div class="layui-col-md12">
				    <label class="layui-form-label">留言内容</label>
				    <div class="layui-input-inline">
				      <textarea name="txtContent" placeholder="请输入留言内容" autocomplete="off" class="layui-input longtxt">{$mGuestbookExt.content}</textarea>
				    </div>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				  <div class="layui-col-md12">
				    <label class="layui-form-label">回复内容</label>
				    <div class="layui-input-inline">
				      <textarea name="txtReply" placeholder="请输入回复内容" autocomplete="off" class="layui-input longtxt">{$mGuestbookExt.reply}</textarea>
				    </div>
				    </div>
				  </div>
				  
				  
				  <div class="layui-form-item">
				  <div class="layui-col-md12">
				    <label class="layui-form-label">邮箱</label>
				    <div class="layui-input-inline">
				      <input type="text" name="txtEmail" value="{$mGuestbookExt.email}" placeholder="请输入邮箱" autocomplete="off" class="layui-input longtxt">
				    </div>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				  <div class="layui-col-md12">
				    <label class="layui-form-label">电话</label>
				    <div class="layui-input-inline">
				      <input type="text" name="txtPhone" value="{$mGuestbookExt.phone}" placeholder="请输入电话" autocomplete="off" class="layui-input longtxt">
				    </div>
				    </div>
				  </div>
				  
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">是否审核</label>
				    <div class="layui-input-inline">
				      <input type="checkbox" name="isChecked" {if condition="$mGuestbook['is_checked'] eq 1"} checked="checked"{/if} value="1" title="是" >
				    </div>
				  </div>
				  
				   <div class="layui-form-item">
				    <label class="layui-form-label">是否推荐</label>
				    <div class="layui-input-inline">
				      <input type="checkbox" name="isRecommend" {if condition="$mGuestbook['is_recommend'] eq 1"} checked="checked"{/if} value="1" title="是" >
				    </div>
				  </div>
				  
				  <input name="txtGbno" type="hidden" value="{$mGuestbook['guestbook_id']}"/>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="type-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/lib/layui/layui.js"></script>
<script src="__PEAR__/component/pear/pear.js"></script>
<script>

var ue = UE.getEditor('editor');
//编辑器加载完毕后执行操作
ue.ready(function() {
	ue.setContent('{$one["ad_code"]|raw}',false);
});

layui.use(['form','jquery','laydate'],function(){
	
	var laydate = layui.laydate;
    let form = layui.form;
    let $ = layui.jquery;
    
    
    var path="/{$MODULE_NAME}/portal/Guestbook";
	var _url="/save";
    form.on('submit(type-save)', function(data){
        $.ajax({
            url:path+_url,
            data:JSON.stringify(data.field),
            dataType:'json',
            contentType:'application/json',
            type:'post',
            success:function(result){
                if(result.code){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("guestbook-table",{
							where:{}
						});
                    });
                }else{
                    layer.msg(result.msg,{icon:2,time:1000});
                }
            }
        })
        return false;
    });
})
</script>
<script>
</script>
</body>
</html>